/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function() {
    
    $(".eraser").live("click",function(){
      $("form").attr("action","deleteNews");
      $("form").submit();
    });

    $(".btnReserv").live("click",function(){
        if($(this).attr("id") == "ReservConfirm"){
            $("#ReservConfirm").removeClass("btnReserv");
            $("#NewsRequest").addClass("btnReserv");
            consultar("refrescaReservaPendiente");
        }else{
            $("#NewsRequest").removeClass("btnReserv");
            $("#ReservConfirm").addClass("btnReserv");
        }
        $(".pag2").slideToggle();
        $(".pag1").slideToggle();
    });
});

function consultar(ejecutar) {
    /*var str = $('.ud_id').attr('value');*/

   if (window.XMLHttpRequest) {
      xmlhttp = new XMLHttpRequest();
   }
   xmlhttp.onreadystatechange = function () {
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
         /*document.getElementById("txtuser").innerHTML = xmlhttp.responseText;*/
         //alert(xmlhttp.responseText);
      }
   }
   /*xmlhttp.open("GET", "ajaxupdate.php?q=" + str, true);*/
   xmlhttp.open("GET", "../includes/refreshDataReserv.php?cod=" + ejecutar, true);
   xmlhttp.send();
}